﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace QuangMobile.Admin
{
    public partial class Footer : System.Web.UI.Page
    {
        private string madm;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["madm"] != null)
            {
                madm = Request.QueryString["madm"].ToString();
            }
            if (!IsPostBack)
            {
                LoadThongTinFooter();
            }
        }

        protected void LoadThongTinFooter()
        {
            string sql = "SELECT * FROM dbo.tblWebContent WHERE MaDM = 'footer'";
            DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, sql);
            txtFooter.Value = dt.Rows[0]["NoiDung"].ToString();
        }

        protected void btnCapNhat_Click(object sender, EventArgs e)
        {
            string sql = "UPDATE dbo.tblWebContent SET NoiDung = @NoiDung WHERE MaDM = 'footer'";
            List<SqlParameter> arrParams = new List<SqlParameter>();
            arrParams.Add(SqlHelper.CreateParameterObject("@NoiDung", SqlDbType.NText, ParameterDirection.Input, txtFooter.Value));
            SqlHelper.ExecuteNonQuery(CommandType.Text, sql, arrParams);
        }
    }
}
